﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.OsnovnoSredstvo"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class OsnovnoSredstvoEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ID property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxID;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ID property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDLabel;
		
		/// <summary>
		/// ComboBox for the IDParentOS property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDParentOS;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDParentOS property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDParentOSLabel;
		
		/// <summary>
		/// ComboBox for the IDDobavljac property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDDobavljac;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDDobavljac property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDDobavljacLabel;
		
		/// <summary>
		/// TextBox for the Naziv property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxNaziv;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Naziv property.
		/// </summary>
		protected System.Windows.Forms.Label uxNazivLabel;
		
		/// <summary>
		/// TextBox for the Sifra property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxSifra;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Sifra property.
		/// </summary>
		protected System.Windows.Forms.Label uxSifraLabel;
		
		/// <summary>
		/// TextBox for the Kolicina property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxKolicina;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Kolicina property.
		/// </summary>
		protected System.Windows.Forms.Label uxKolicinaLabel;
		
		/// <summary>
		/// DataTimePicker for the DatumKnjizenja property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxDatumKnjizenja;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the DatumKnjizenja property.
		/// </summary>
		protected System.Windows.Forms.Label uxDatumKnjizenjaLabel;
		
		/// <summary>
		/// TextBox for the Opis property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxOpis;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Opis property.
		/// </summary>
		protected System.Windows.Forms.Label uxOpisLabel;
		
		/// <summary>
		/// TextBox for the Napomena property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxNapomena;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Napomena property.
		/// </summary>
		protected System.Windows.Forms.Label uxNapomenaLabel;
		
		/// <summary>
		/// TextBox for the TvBroj property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxTvBroj;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the TvBroj property.
		/// </summary>
		protected System.Windows.Forms.Label uxTvBrojLabel;
		
		/// <summary>
		/// TextBox for the Detalji property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxDetalji;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Detalji property.
		/// </summary>
		protected System.Windows.Forms.Label uxDetaljiLabel;
		#endregion
		
		#region Main entity
		private Entities.OsnovnoSredstvo _OsnovnoSredstvo;
		/// <summary>
		/// Gets or sets the <see cref="Entities.OsnovnoSredstvo"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.OsnovnoSredstvo"/> instance.</value>
		public Entities.OsnovnoSredstvo OsnovnoSredstvo
		{
			get {return this._OsnovnoSredstvo;}
			set
			{
				this._OsnovnoSredstvo = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxID.DataBindings.Clear();
			this.uxID.DataBindings.Add("Text", this.uxBindingSource, "ID", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDParentOS.DataBindings.Clear();
			this.uxIDParentOS.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDParentOS", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDDobavljac.DataBindings.Clear();
			this.uxIDDobavljac.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDDobavljac", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNaziv.DataBindings.Clear();
			this.uxNaziv.DataBindings.Add("Text", this.uxBindingSource, "Naziv", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxSifra.DataBindings.Clear();
			this.uxSifra.DataBindings.Add("Text", this.uxBindingSource, "Sifra", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxKolicina.DataBindings.Clear();
			this.uxKolicina.DataBindings.Add("Text", this.uxBindingSource, "Kolicina", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDatumKnjizenja.DataBindings.Clear();
			this.uxDatumKnjizenja.DataBindings.Add("Value", this.uxBindingSource, "DatumKnjizenja", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxOpis.DataBindings.Clear();
			this.uxOpis.DataBindings.Add("Text", this.uxBindingSource, "Opis", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNapomena.DataBindings.Clear();
			this.uxNapomena.DataBindings.Add("Text", this.uxBindingSource, "Napomena", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxTvBroj.DataBindings.Clear();
			this.uxTvBroj.DataBindings.Add("Text", this.uxBindingSource, "TvBroj", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDetalji.DataBindings.Clear();
			this.uxDetalji.DataBindings.Add("Text", this.uxBindingSource, "Detalji", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="OsnovnoSredstvoEditControlBase"/> class.
		/// </summary>
		public OsnovnoSredstvoEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_OsnovnoSredstvo != null) _OsnovnoSredstvo.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxID = new System.Windows.Forms.TextBox();
			uxIDLabel = new System.Windows.Forms.Label();
			this.uxIDParentOS = new System.Windows.Forms.ComboBox();
			uxIDParentOSLabel = new System.Windows.Forms.Label();
			this.uxIDDobavljac = new System.Windows.Forms.ComboBox();
			uxIDDobavljacLabel = new System.Windows.Forms.Label();
			this.uxNaziv = new System.Windows.Forms.TextBox();
			uxNazivLabel = new System.Windows.Forms.Label();
			this.uxSifra = new System.Windows.Forms.TextBox();
			uxSifraLabel = new System.Windows.Forms.Label();
			this.uxKolicina = new System.Windows.Forms.TextBox();
			uxKolicinaLabel = new System.Windows.Forms.Label();
			this.uxDatumKnjizenja = new System.Windows.Forms.DateTimePicker();
			uxDatumKnjizenjaLabel = new System.Windows.Forms.Label();
			this.uxOpis = new System.Windows.Forms.TextBox();
			uxOpisLabel = new System.Windows.Forms.Label();
			this.uxNapomena = new System.Windows.Forms.TextBox();
			uxNapomenaLabel = new System.Windows.Forms.Label();
			this.uxTvBroj = new System.Windows.Forms.TextBox();
			uxTvBrojLabel = new System.Windows.Forms.Label();
			this.uxDetalji = new System.Windows.Forms.TextBox();
			uxDetaljiLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIDLabel
			//
			this.uxIDLabel.Text = "ID:";
			this.uxIDLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIDLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDLabel);			
			//
			// uxID
			//
			this.uxID.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxID);
			this.uxID.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxID);
			//
			// uxIDParentOSLabel
			//
			this.uxIDParentOSLabel.Text = "IDParentOS:";
			this.uxIDParentOSLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxIDParentOSLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDParentOSLabel);			
			//
			// uxIDParentOS
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDParentOS);
			this.uxIDParentOS.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxIDParentOS);
			//
			// uxIDDobavljacLabel
			//
			this.uxIDDobavljacLabel.Text = "IDDobavljac:";
			this.uxIDDobavljacLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxIDDobavljacLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDDobavljacLabel);			
			//
			// uxIDDobavljac
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDDobavljac);
			this.uxIDDobavljac.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxIDDobavljac);
			//
			// uxNazivLabel
			//
			this.uxNazivLabel.Text = "Naziv:";
			this.uxNazivLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxNazivLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNazivLabel);			
			//
			// uxNaziv
			//
			this.uxNaziv.Width = 250;
			this.uxNaziv.MaxLength = 100;
			//this.uxTableLayoutPanel.Controls.Add(this.uxNaziv);
			this.uxNaziv.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxNaziv);
			//
			// uxSifraLabel
			//
			this.uxSifraLabel.Text = "Sifra:";
			this.uxSifraLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxSifraLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxSifraLabel);			
			//
			// uxSifra
			//
			this.uxSifra.Width = 250;
			this.uxSifra.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxSifra);
			this.uxSifra.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxSifra);
			//
			// uxKolicinaLabel
			//
			this.uxKolicinaLabel.Text = "Kolicina:";
			this.uxKolicinaLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxKolicinaLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxKolicinaLabel);			
			//
			// uxKolicina
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxKolicina);
			this.uxKolicina.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxKolicina);
			//
			// uxDatumKnjizenjaLabel
			//
			this.uxDatumKnjizenjaLabel.Text = "DatumKnjizenja:";
			this.uxDatumKnjizenjaLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxDatumKnjizenjaLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDatumKnjizenjaLabel);			
			//
			// uxDatumKnjizenja
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxDatumKnjizenja);
			this.uxDatumKnjizenja.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxDatumKnjizenja);
			//
			// uxOpisLabel
			//
			this.uxOpisLabel.Text = "Opis:";
			this.uxOpisLabel.Location = new System.Drawing.Point(3, 182);
			this.Controls.Add(this.uxOpisLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxOpisLabel);			
			//
			// uxOpis
			//
			this.uxOpis.Width = 250;
			this.uxOpis.MaxLength = 400;
			//this.uxTableLayoutPanel.Controls.Add(this.uxOpis);
			this.uxOpis.Location = new System.Drawing.Point(160, 182);
			this.Controls.Add(this.uxOpis);
			//
			// uxNapomenaLabel
			//
			this.uxNapomenaLabel.Text = "Napomena:";
			this.uxNapomenaLabel.Location = new System.Drawing.Point(3, 208);
			this.Controls.Add(this.uxNapomenaLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNapomenaLabel);			
			//
			// uxNapomena
			//
			this.uxNapomena.Width = 250;
			this.uxNapomena.MaxLength = 400;
			//this.uxTableLayoutPanel.Controls.Add(this.uxNapomena);
			this.uxNapomena.Location = new System.Drawing.Point(160, 208);
			this.Controls.Add(this.uxNapomena);
			//
			// uxTvBrojLabel
			//
			this.uxTvBrojLabel.Text = "TvBroj:";
			this.uxTvBrojLabel.Location = new System.Drawing.Point(3, 234);
			this.Controls.Add(this.uxTvBrojLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxTvBrojLabel);			
			//
			// uxTvBroj
			//
			this.uxTvBroj.Width = 250;
			this.uxTvBroj.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxTvBroj);
			this.uxTvBroj.Location = new System.Drawing.Point(160, 234);
			this.Controls.Add(this.uxTvBroj);
			//
			// uxDetaljiLabel
			//
			this.uxDetaljiLabel.Text = "Detalji:";
			this.uxDetaljiLabel.Location = new System.Drawing.Point(3, 260);
			this.Controls.Add(this.uxDetaljiLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDetaljiLabel);			
			//
			// uxDetalji
			//
			this.uxDetalji.Width = 250;
			this.uxDetalji.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxDetalji);
			this.uxDetalji.Location = new System.Drawing.Point(160, 260);
			this.Controls.Add(this.uxDetalji);
			//
			// uxIDDobavljac
			//				
			this.uxIDDobavljac.DisplayMember = "ImeKlijenta";	
			this.uxIDDobavljac.ValueMember = "ID";	
			//
			// uxIDParentOS
			//				
			this.uxIDParentOS.DisplayMember = "IDParentOS";	
			this.uxIDParentOS.ValueMember = "ID";	
			// 
			// OsnovnoSredstvoEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "OsnovnoSredstvoEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.Klijent> _IDDobavljacList;
		
		/// <summary>
		/// The ComboBox associated with the IDDobavljac property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Klijent> IDDobavljacList
		{
			get {return _IDDobavljacList;}
			set 
			{
				this._IDDobavljacList = value;
				this.uxIDDobavljac.DataSource = null;
				this.uxIDDobavljac.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDDobavljacList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDDobavljac property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDDobavljacList
		{
			get { return _allowNewItemInIDDobavljacList;}
			set
			{
				this._allowNewItemInIDDobavljacList = value;
				this.uxIDDobavljac.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.OsnovnoSredstvo> _IDParentOSList;
		
		/// <summary>
		/// The ComboBox associated with the IDParentOS property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.OsnovnoSredstvo> IDParentOSList
		{
			get {return _IDParentOSList;}
			set 
			{
				this._IDParentOSList = value;
				this.uxIDParentOS.DataSource = null;
				this.uxIDParentOS.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDParentOSList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDParentOS property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDParentOSList
		{
			get { return _allowNewItemInIDParentOSList;}
			set
			{
				this._allowNewItemInIDParentOSList = value;
				this.uxIDParentOS.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
